home *** CD-ROM | disk | FTP | other *** search
- ' This is the second macro in the 600 series, which creates the
- ' small area boxes. Once done, if the area is larger than 46 meters
- ' is launches the large area macro. If not, it launches the small area
- ' macro, see the bottom of the file for the chain command.
- '
- ' Get Values from data file.
- '
- ' Based on RType chosen by user above
- open "i", 1, "*\sample macros\600.txt"
- ' Assign #s found to Variables
- Input #1, AddLen
- Input #1, TH
- Input #1, PanNum2
- Input #1, PanNum
- ' Close File
- Close #1
- '
- '
- ' Get Current Layer
- CurLay = Sys(3)
- '
- ' Get Current Line Width
- CurThick = Sys(6)
- '
- ' Set Rubber band type to Plane for area command
- Sys(41) = 13
- '
- ' Make Layer 11 the current layer
- Layer(11) = 14
- Sys$(93) = "Please Leave Empty !!"
- Precision 2
- '
- ' Prompt User for up to 50 points for boundary of area
- setpoint "Set up to 50 points for the area . . . then press Enter when finished." 50
- '
- ' If user set only 2 points, there can be no area
- if sys(1) < 3 then
- Message "Please run the program again and set more than 2 points for the area."
- End
- endif
- '
- ' Create an Array for the points the user sets
- Dim X(50), Y(50), Z(50)
- '
- ' Store points the user just set into the Array
- for a = 1 to Sys(1)
- PointVal X(a), Y(a), Z(a) a
- next a
- '
- ' Loop to Draw Plane with points from the Array
- >Plane
- {
- for a = 1 to Sys(1)
- <Pointxyz [X(a), Y(a), Z(a)]
- next a
- }
- '
- ' Select Layer 11
- >SelectLayer
- {
- <Layer 11
- }
- '
- ' Get XYZ location of the cursor after Plane is done
- getxy x1 y1 z1
- '
- ' Set Count to the number of entities in the drawing
- ' The plane was drawn last, so it's the item we want
- Count = Sys(9)
- '
- ' Get Entity ID for the plane just drawn
- getselect 1, entID
- '
- ' Get Area (or Square Meters) of the plane
- Area1 = Area(entID)
- '
- ' Get Length (or Parameter) of the plane
- Len0 = Length(entID)
- '
- Len1 = Len0 + AddLen
- '
- ' Round Results up to nearest whole #
- Precision 0
- Area2 = ROUND(Area1)
- Len2 = ROUND(Len1)
- Precision 2
- '
- ' Section Added to account for Areas of 46 or less
- if Area1 <= 46 then
- Box = 0
- else
- Box = 1
- endif
- ' Delete Plane, it's no longer needed
- >SelectDelete
- {
- }
- '
- ' Display Results to screen for testing
- ' Message Area2
- ' Message Len2
- ' Silent Mode On
- Sys(36) = 1
- ' Add Area to Layer 12
- Layer(12) = 14
- Sys$(93) = "6x6 Areas"
- >Attribute
- {
- <size 2
- <text [Area1]
- <pointxyz 10, 10, 0
- }
- ' Add Length to Layer 13
- Layer(13) = 14
- Sys$(93) = "6x6 Lengths"
- >Attribute
- {
- <size 2
- <text [Len1]
- <pointxyz 10, 10, 0
- }
- ' Back to Layer 11
- Layer(11) = 14
- '
- ' Select Object when Created
- Sys(242) = 1
- '
- ' Silent Mode On
- Sys(36) = 1
- ' Rem this back in if text sizes under 1 become a problem
- ' if TH < 1 then TH = 1
- ' Get Old Text Height
- OLDTH = Sys(12)
- ' Set new Text height
- Sys(12) = TH
- ' Create the Area Info Box
- ' Convert to Strings for use in Text Block
- Precision 0
- Area$ = Area2
- Len$ = Len2
- ' Strings for Text Labels
- Area2$ = "Sm"
- Len2$ = "Lm"
- Precision 2
- ' Select Object when Created is on
- Sys(242) = 1
- '
- ' Get Current Drawing Color
- ccRed = Sys(300)
- ccGreen = Sys(301)
- ccBlue = Sys(302)
- ' Create New File to draw Area box in
- >New
- {
- }
- ' Set Color to Red
- Sys(300) = 255
- Sys(301) = 0
- Sys(302) = 0
- ' Back to Layer 11
- Layer(11) = 14
- '
- ' Not sure if this is still needed . . .
- MinnY = Sys(187)
- ' Set Current Line Width to Zero
- Sys(6) = 0
- ' Make Text Block of information
- >TextBlock
- {
- <size [TH]
- <Distance 0.5
- <TextBegin
- <Text [Area$]
- <Text [Len$]
- <justification 2
- <pointxyz 0, [MinnY - 20], 0
- }
- ' Get Current Max X values to place labled behind the text values
- M = Sys(198)
- M = M + 1
- ' Reset Color
- Sys(300) = ccRed
- Sys(301) = ccGreen
- Sys(302) = ccBlue
- '
- ' Select Object when Created is off
- Sys(242) = 0
- ' Make Text Block of information
- >TextBlock
- {
- <Style 0
- <Distance 0.5
- <TextBegin
- <Text [Area2$]
- <Text [Len2$]
- <justification 0
- <pointxyz [M], [MinnY - 20], 0
- }
- '
- ' Select Object when Created is off
- Sys(242) = 0
- '
- ' Select Entire Drawing
- >SelectAll
- {
- }
- '
- ' Scale down the Info Box to a much smaller size
- ' Based on Diff in line 5
- ' Move Info Box to resize it
- ' >Move
- ' {
- ' <Type 0
- ' <Pointxyz 0, 0, 0
- ' <Pointrel [Diff], 0, 0
- ' }
- ' '
- ' Copy Area Box back into main drawing
- >Copy
- {
- }
- '
- ' Close Temp Drawing
- >Close
- {
- <SaveChanges 0
- }
- ' Silent Mode Off
- Sys(36) = 0
- ' Refresh the Screen
- >Regenerate
- {
- }
- ' Back to Layer 11
- Layer(11) = 14
- '
- ' Paste the info box in again
- >Paste
- {
- <Type 0
- ' 0 = Changeable scale (based on distance between handles 1 and 2); 1 = Fixed scale (always paste at original size)
- <SelectOnly 0
- '
- ' 0 = select the pasted object; 1 = leave the pasted object unselected
- <pointxyz 0,0,0
- }
- '
- ' Select Layer 11
- >SelectLayer
- {
- <Layer 11
- }
- ' Get Min and Max of the current Selection
- MinX = Sys(196)
- MinY = Sys(197)
- MaxX = Sys(198)
- MaxY = Sys(199)
- ' Set Handle
- >SetHandle
- {
- <pointxyz [MinX,MinY],0
- <pointxyz [MaxX,MinY],0
- }
- ' Loop for Moving Box from Layer 11 to the current layer
- for a = 1 to Sys(9)
- getattr a, type, select, laynum, group, red, green, blue
-
- if laynum = 11 then laynum = 9
- Putattr a, type, select, laynum, group, red, green, blue
- next a
- ' Switch to and Name Layer 9
- Sys(3) = 9
- Sys$(93) = "6x6 Area Boxes"
- '
- ' Silent Mode Off
- Sys(36) = 0
- '
- ' Refresh the Drawing
- >Regenerate
- {
- }
- ' Move the Box
- >Move
- {
- <Type 0
- }
- '
- ' Refresh the Screen to see text in area box
- >Regenerate
- {
- }
- '
- ' Deselect the Box after it's been placed
- >PointSelect
- {
- <Type 0
- <pointxyz -100, -100, 100
- }
- '
- ' Return to previous Current Layer
- Sys(3) = CurLay
- '
- if Area1 <= 46 then
- Chain "600_3_InfoS.d3m"
- else
- Chain "600_3_InfoL.d3m"
- endif
- end
-
-